from django.db import models
from django.contrib.auth.models import User

class RecyclingPoint(models.Model):
    name = models.CharField(max_length=200)
    address = models.CharField(max_length=500)
    latitude = models.DecimalField(max_digits=10, decimal_places=8)
    longitude = models.DecimalField(max_digits=11, decimal_places=8)
    phone = models.CharField(max_length=20, blank=True)
    business_hours = models.CharField(max_length=100, blank=True)
    description = models.TextField(blank=True)
    STATUS_CHOICES = [
        ('active', 'Active'),
        ('inactive', 'Inactive'),
    ]
    status = models.CharField(max_length=10, choices=STATUS_CHOICES, default='active')
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    
    # 运营监控字段 - 对应我的页面回收指引
    view_count = models.IntegerField(default=0, help_text="回收点查看次数")
    direction_view_count = models.IntegerField(default=0, help_text="路线查看次数")
    last_accessed_at = models.DateTimeField(null=True, blank=True, help_text="最后访问时间")

    def __str__(self):
        return str(self.name)